﻿using System.Windows.Input;

using EMan.Common.DependencyInjection;
using EMan.Common.EnterpriseStructure;
using EMan.Interface.EnterpriseStructure.Employees;

using TrueCode.Core.Aspects;

namespace EMan.GUI.EditStructure
{
  /// <summary>
  /// Interaction logic for JobChooserView.xaml
  /// </summary>
  public partial class JobChooserView : IJobChooserView, IJobChooserGuiElement
  {
    #region .ctors
    public JobChooserView( [NotNull] IFactory factory, [NotNull] IJobChooserPresenter presenter ) : base( factory, presenter )
    {
      InitializeComponent();
    }
    #endregion

    #region Entry points
    private void OnListBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
    {
      if( _listbox.SelectedItem != null )
      {
        Presenter.SelectedJob = ( Job )_listbox.SelectedItem;
        Presenter.OkCommand.Execute(null);
      }
    }
    #endregion

    #region Implementation of IJobChooserGuiElement
    public Job ChoosedJob
    {
      get { return Presenter.SelectedJob; }
    }
    #endregion
  }
}
